import { handleActions } from "redux-actions";
import { FIND_TYPE } from "../types.js";
import _ from "lodash";

// 初始化数据
const InitData ={
    title: "新鲜蔬果",
    labels: [
        {
            _id: "619eeb6a26db96318ca530bd",
            title: "豆类"
        }
    ]
}


export const findType = handleActions({
    // 获取所有类型
    [FIND_TYPE]: (state, { payload }) => {
        const { labels, title } = payload;
        return _.assign({},state,{
            labels, title
        })
    },
}, InitData)